home *** CD-ROM | disk | FTP | other *** search
- global scoreData, bgdData, fgdFXData, bgdFXData, soundFXData, soundLoopData, currentFrame
-
- on birth me
- reset(me)
- return me
- end
-
- on reset me
- resetScoreData(me)
- resetBgdData(me)
- resetFgdFXData(me)
- resetBgdFXData(me)
- resetSoundFXData(me)
- resetSoundLoopData(me)
- end
-
- on resetScoreData me
- set scoreData to [[[], [], [], [], [], [], [], [], [], [], [], []]]
- end
-
- on resetBgdData me
- set bgdData to [[5051, 313, 243]]
- set theBackground to getAt(bgdData, 1)
- set the castNum of sprite 1 to getAt(theBackground, 1)
- set the locH of sprite 1 to getAt(theBackground, 2)
- set the locV of sprite 1 to getAt(theBackground, 3)
- end
-
- on resetFgdFXData me
- set fgdFXData to [[]]
- end
-
- on resetBgdFXData me
- set bgdFXData to [[EMPTY, 0]]
- end
-
- on resetSoundFXData me
- set soundFXData to [[EMPTY, 0]]
- end
-
- on resetSoundLoopData me
- set soundLoopData to [[EMPTY, 0]]
- end
-
- on addFrame me, theFrame, curDataChannel
- set emptyFrameList to [[], [], [], [], [], [], [], [], [], [], [], []]
- if currentFrame > count(scoreData) then
- setAt(scoreData, currentFrame, copyList(emptyFrameList))
- end if
- setAt(getAt(scoreData, currentFrame), curDataChannel, theFrame)
- end
-
- on addFrames me, startFrame, theFrames, curDataChannel
- set emptyFrameList to [[], [], [], [], [], [], [], [], [], [], [], []]
- set theFrameNumber to startFrame
- repeat with theFrame in theFrames
- if theFrameNumber > count(scoreData) then
- setAt(scoreData, theFrameNumber, copyList(emptyFrameList))
- end if
- setAt(getAt(scoreData, theFrameNumber), curDataChannel, theFrame)
- set theFrameNumber to theFrameNumber + 1
- end repeat
- end
-
- on removeFrames me, numberOfFrames
- repeat with theFrame = 1 to numberOfFrames
- deleteAt(scoreData, currentFrame)
- if count(bgdData) >= currentFrame then
- deleteAt(bgdData, currentFrame)
- end if
- if count(fgdFXData) >= currentFrame then
- deleteAt(fgdFXData, currentFrame)
- end if
- if count(bgdFXData) >= currentFrame then
- deleteAt(bgdFXData, currentFrame)
- end if
- if count(soundFXData) >= currentFrame then
- deleteAt(soundFXData, currentFrame)
- end if
- if count(soundLoopData) >= currentFrame then
- deleteAt(soundLoopData, currentFrame)
- end if
- end repeat
- end
-
- on preloadCartoon me
- updateStatusBar(1)
- set thePreloadList to buildContentList(me)
- set thePreviousCastNumber to 0
- sort(thePreloadList)
- updateStatusBar(1)
- repeat with theCastNumber in thePreloadList
- if theCastNumber <> thePreviousCastNumber then
- preLoadCast(theCastNumber)
- set thePreviousCastNumber to theCastNumber
- if the preLoad of cast theCastNumber = 0 then
- exit repeat
- end if
- end if
- updateStatusBar(1)
- end repeat
- end
-
- on estimateCastSize me
- set thePreloadList to buildContentList(me)
- set estimatedCastSize to 0
- set thePreviousCastNumber to 0
- sort(thePreloadList)
- repeat with theCastNumber in thePreloadList
- if theCastNumber <> thePreviousCastNumber then
- set estimatedCastSize to estimatedCastSize + the size of cast theCastNumber
- set thePreviousCastNumber to theCastNumber
- end if
- end repeat
- set listOfLists to [scoreData, bgdData, fgdFXData, bgdFXData, soundFXData, soundLoopData]
- repeat with theList in listOfLists
- set estimatedCastSize to estimatedCastSize + count(theList)
- end repeat
- return estimatedCastSize
- end
-
- on buildContentList me
- set thePreloadList to []
- updateStatusBar(1)
- set i to 1
- repeat with theFrame in scoreData
- repeat with theLayer in theFrame
- if theLayer <> EMPTY then
- set theCastNumber to getAt(theLayer, 1)
- append(thePreloadList, theCastNumber)
- end if
- end repeat
- if (i mod 100) = 0 then
- updateStatusBar(1)
- end if
- set i to i + 1
- end repeat
- updateStatusBar(1)
- set i to 1
- repeat with theFrame in bgdData
- if theFrame <> EMPTY then
- set theCastNumber to getAt(theFrame, 1)
- append(thePreloadList, theCastNumber)
- end if
- if (i mod 100) = 0 then
- updateStatusBar(1)
- end if
- set i to i + 1
- end repeat
- updateStatusBar(1)
- set i to 1
- repeat with theFrame in fgdFXData
- if theFrame <> EMPTY then
- set theCastNumber to getAt(theFrame, 1)
- append(thePreloadList, theCastNumber)
- end if
- if (i mod 100) = 0 then
- updateStatusBar(1)
- end if
- set i to i + 1
- end repeat
- updateStatusBar(1)
- set i to 1
- repeat with theFrame in bgdFXData
- if theFrame <> [EMPTY, 0] then
- set theCastNumber to getAt(theFrame, 2)
- append(thePreloadList, theCastNumber)
- end if
- if (i mod 100) = 0 then
- updateStatusBar(1)
- end if
- set i to i + 1
- end repeat
- updateStatusBar(1)
- set i to 1
- repeat with theFrame in soundFXData
- if theFrame <> [EMPTY, 0] then
- set theCastNumber to getAt(theFrame, 2)
- append(thePreloadList, theCastNumber)
- end if
- if (i mod 100) = 0 then
- updateStatusBar(1)
- end if
- set i to i + 1
- end repeat
- updateStatusBar(1)
- set i to 1
- repeat with theFrame in soundLoopData
- if theFrame <> [EMPTY, 0] then
- set theCastNumber to getAt(theFrame, 2)
- append(thePreloadList, theCastNumber)
- end if
- if (i mod 100) = 0 then
- updateStatusBar(1)
- end if
- set i to i + 1
- end repeat
- updateStatusBar(1)
- return thePreloadList
- end
-